<template>
	<view>
		<view class="login-logo">
			<view class="logo-wrap">
				<image class="logo" src="/static/images/test01.jpg"></image>
			</view>
			<view class="user-name">
				<text class="name">小柏佰</text>
			</view>
		</view>
		<view class="form-group">
			<view class="form-item">
				<view class="label">账号：</view>
				<view class="text-cont">
					<text class="text">183******0876</text>
					<text class="icon iconfont iconiconfontjiantou5"></text>
				</view>
			</view>
			<view class="form-item">
				<view class="label">密码：</view>
				<view class="text-cont" @tap="showPopup">
					<text class="text">修改</text>
					<text class="icon iconfont iconiconfontjiantou5"></text>
				</view>
			</view>
			<button class="exit-btn" type="default" :disabled="isDisabled" @tap="exitLogin">
				<text class="iconfont icontuichu icon" style="font-size: 40rpx;"></text>退出登录</button>
		</view>
		<uni-popup ref="popup" type="bottom">
			<view class="form-group-wraper">
				<view class="btn-group">
					<text class="btn btn-cancel" @tap="handleClickBtn(0)">取消</text>
					<text class="btn btn-confirm" @tap="handleClickBtn(1)">确定</text>
				</view>
				<view class="modify-form-wraper">
					<view class="form-item">
						<label class="label" for="#pasword">旧密码：</label>
						<input id="pasword" class="input" type="password" value="" name="oldpassword" placeholder="请输入旧密码" />
					</view>
					<view class="form-item">
						<label class="label" for="#pasword">新密码：</label>
						<input id="pasword" class="input" type="password" value="" name="newpassword" placeholder="请输入新密码" />
					</view>
				</view>
			</view>
		</uni-popup>
	</view>

</template>

<script>
	import uniPopup from '@/components/uni-popup/uni-popup.vue'
	import uniPopupMessage from '@/components/uni-popup/uni-popup-message.vue'
	import uniPopupDialog from '@/components/uni-popup/uni-popup-dialog.vue'
	export default {
		name: 'my',
		props: {

		},
		components: {
			uniPopup,
			uniPopupMessage,
			uniPopupDialog
		},
		data() {
			return {
				isDisabled: false, // 退出按钮是否禁用
			};
		},
		methods: {
			handleClickBtn(val) { // 点击确定或取消修改按钮，0为取消，1为确认
				switch (val) {
					case 0:
						console.log('点击了取消');
						break;
					case 1:
						console.log('点击了确认');
						break;
					default:
						break;
				}
				this.$refs.popup.close(); // 关闭底部弹出层
			},
			showPopup() { // 显示底部弹出层
				this.$refs.popup.open();
			},
			exitLogin() {
				uni.showModal({
					title: '提示：',
					content: '您确定要退出吗？',
					success(res) {
						if (res.confirm) { // 确定
							uni.reLaunch({
								url: '/pages/login/login'
							})
						} else if (res.cancel) { // 取消
							console.log('用户点击取消');
						}
					}
				})

			}

		}
	};
</script>

<style lang="scss" scoped>
	.login-logo {
		display: flex;
		align-items: center;
		justify-content: center;
		flex-wrap: wrap;
		width: 750rpx;
		padding: 60rpx 0;
		background-color: #1267f6;

		.logo-wrap {
			width: 140rpx;
			height: 140rpx;
			padding: 6rpx;
			border-radius: 50%;
			overflow: hidden;
			background: white;

		}

		.logo {
			width: 100%;
			height: 100%;
			border-radius: 50%;

		}

		.user-name {
			margin-top: 30rpx;
			width: 100%;
			font-size: 50rpx;
			color: white;
			text-align: center;
		}
	}

	.form-group {
		padding: 30rpx;
		min-height: calc(100vh - 300rpx);
		background: #f7f7f7;
	}

	.form-item {
		display: flex;
		align-items: center;
		padding: 0 20rpx;
		line-height: 100rpx;
		font-size: 36rpx;
		color: #696969;
		border-bottom: 1px solid #e8e8e8;

		.text-cont {
			flex: 1;
			text-align: right;

			.text {
				margin-right: 30rpx;
			}
		}
	}

	.exit-btn {
		position: fixed;
		left: 0;
		right: 0;
		margin: auto;
		bottom: 230rpx;
		height: 100rpx;
		width: 340rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 38rpx;
		color: white;
		border-radius: 50rpx;
		background-color: #1267f6;
		z-index: 98;

		.icon {
			margin-right: 16rpx;
		}

		&::after {
			border: none;
		}

	}

	/* 底部弹出 start  */
	.form-group-wraper {
		padding: 20rpx 30rpx 40rpx;
		background: white;
		font-size: 36rpx;
		border-top-left-radius: 30rpx;
		border-top-right-radius: 30rpx;

		.btn-group {
			margin-bottom: 55rpx;
			display: flex;
			justify-content: space-between;
		}

		.btn-confirm {
			color: #3981f7;
		}

		.label {
			color: #333;
		}

		.form-item {
			margin-bottom: 20rpx;
			border: none;
			line-height: 90rpx;
			background-color: #d9e9f8;
			border-radius: 10rpx;
		}
	}
</style>
